#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include"sys/syscall.h"
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#include<string.h>
int main(int argc,char *argv[])
{
   	
	int sec;
	int readfile;
	int result;
	int count=0;
        char ch;
        char str[16];
        int i=0,j;
        if((sec = open(argv[1],O_RDONLY))==-1)
        {
                printf("Failure to open %s !\n",argv[0]);
                exit(0);
        }
        while((readfile=read(sec,str,16)))
        {	       
			printf("%07o",count);		
			for(i=0;i<readfile;i++)
			printf("  %02x",str[i]);
                        printf("\n");
			printf("       ");
			for(j=0;j<readfile;j++)
			if(str[j]=='\n')
			printf("  \\n");
			else
                        printf("%4c",str[j]);
			printf("\n");
			count+=readfile;
	}
	printf("%07o ",count);
	printf("\n");
	result=close(sec);
	return 0;
}

